package org.example;

import java.util.Objects;

/**
 * @BelongsProject: javaFoundation
 * @BelongsPackage: org.example
 * @Author: dtq
 * @CreateTime: 2023-10-30  16:26
 * @Description: 懒汉模式
 * @Version: 1.0
 */
public class Single2 {
    private static Single2 single2;

    private Single2() {

    }

    public static Single2 getSingle2() {

        synchronized (Single2.class) {
            if (Objects.isNull(single2)) {
                new Single2();
            }
        }
        return single2;

    }
}
